package models;
import java.awt.EventQueue;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.border.EmptyBorder;

import objects.SerialContainer;
import utils.LabelConstants;
import utils.SosUtils;

public class MainApplicationNew extends JFrame {

	private SosUtils utils = new SosUtils();
	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MainApplicationNew frame = new MainApplicationNew();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	public MainApplicationNew() {
		ImageIcon search = utils
				.createImageIcon("images/database_search_128.png");
		Locale locale = new Locale("de", "DE");

		ResourceBundle labels = ResourceBundle.getBundle(LabelConstants.RESOURCES, locale);

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(0, 0, 1350, 1000);
		contentPane = new JPanel();
		JScrollPane scrPane = new JScrollPane(contentPane);
		this.add(scrPane);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		tabbedPane.setBounds(238, 0, 898, 900);
		contentPane.add(tabbedPane);

		JPanel mainSuchPanel = new JPanel();
		tabbedPane.addTab(labels.getString(LabelConstants.SUCHE_TAB), search, mainSuchPanel, null);
		mainSuchPanel.setLayout(null);

		// 1 Tab Suchpanel
		SuchModel suchModel = new SuchModel();
		SerialContainer serialContainer = new SerialContainer();
		serialContainer = suchModel.drawSuchPanel(mainSuchPanel);

		// 2Tab Main Add panel
		MainAddModel maModel = new MainAddModel();
		maModel.drawMainAddPanel(tabbedPane);

		// 4Tab Logout Panel
		
		SosUtils utils = new SosUtils();
		ImageIcon quit = utils.createImageIcon("images/quit.png");
		
		LogoutModel lgModel = new LogoutModel();
		lgModel.drawLogoutPanel(tabbedPane, contentPane);
		
		this.repaint();
	}
}
